package com.jinly.ryder.manage.dao.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.jinly.ryder.common.dao.entity.BaseDO;
import com.jinly.ryder.manage.service.model.DeployStatus;
import com.jinly.ryder.manage.service.model.EnvType;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "deploy_group", autoResultMap = true)
public class DeployGroupDO extends BaseDO {

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 部署组名称
     */
    @TableField(value = "name", updateStrategy = FieldStrategy.NEVER)
    private String name;

    /**
     * 部署组展示名称
     */
    @TableField(value = "show_name")
    private String showName;

    /**
     * 应用名称
     */
    @TableField(value = "app_name", updateStrategy = FieldStrategy.NEVER)
    private String appName;

    /**
     * 环境类型
     */
    @TableField(value = "env_type")
    private EnvType envType;

    /**
     * git 分支
     */
    @TableField(value = "git_branch")
    private String gitBranch;

    /**
     * 部署状态，待发布，发布中
     */
    @TableField(value = "deploy_status")
    private DeployStatus deployStatus;

    /**
     * 部署申请ID
     */
    @TableField(value = "apply_id", updateStrategy = FieldStrategy.IGNORED)
    private Long applyId;

    /**
     * 配置参数
     */
    @TableField(value = "props", typeHandler = FastjsonTypeHandler.class)
    private DeployGroupPropDO props;

    @Data
    public static class DeployGroupPropDO {
        /**
         * Java 启动参数
         */
        private String javaOpts;
    }

}
